from GuiObject import *

class GuiWnd(GuiObject):
	def __init__(self, x_, y_, w_, h_, title_, font_):
		GuiObject.__init__(self)
		self.titleText = title_
		self.x = x_
		self.y = y_
		self.w = w_
		self.h = h_
		self.font = pygame.font.Font(font_, 12)
		self.titleImage = pygame.image.load("data/images/windowTitle.png")
		titleBgWidth = self.w - 2
		titleBgHeight = 20
		self.titleBg = pygame.Surface((titleBgWidth, titleBgHeight))
		numX = 2+(titleBgWidth/100)
		print numX
		tempX = 0
		self.titleBg.blit(self.titleImage, (0,0,100,20))
		while tempX <= numX:
			self.titleBg.blit(self.titleImage, ((100*tempX),0,100,20))
			tempX += 1
	def draw(self):
		self.titleTextSurface = self.font.render(self.titleText, 1, (255,255,255))
		pygame.draw.rect(self.screen, (61,61,61), (self.x,self.y,self.w,self.h))
		self.screen.blit(self.titleBg, (self.x+1,self.y+1,self.w-2,20))
		self.screen.blit(self.titleTextSurface, (self.x+6,self.y+4,self.w-4,15))
		for child in self.children:
			child.draw()
		
